package cn.yikaojiuguo.student.ui.usercenter;

import android.content.Intent;
import android.os.Bundle;
import android.widget.GridView;

import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;
import cn.yikaojiuguo.student.R;
import cn.yikaojiuguo.student.adapter.ChooseMajorAdapter;
import cn.yikaojiuguo.student.app.YiKaoApplication;
import cn.yikaojiuguo.student.bean.Category;
import cn.yikaojiuguo.student.support.database.MyDBManager;
import cn.yikaojiuguo.student.support.simple.ArgsConstants;
import cn.yikaojiuguo.student.ui.base.CustomerActionBarActivity;

public class ChooseMajorActivity extends CustomerActionBarActivity {

    @Bind(R.id.gv)
    GridView mGv;
    private List<Category> mList;
    private int mChoose = -1;

    public static Intent newIntent() {
        Intent intent = new Intent(YiKaoApplication.getInstance(),ChooseMajorActivity.class);
        return intent;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_choose_major);
        setCustomerBackVisibility(false);
        ButterKnife.bind(this);
        mList = MyDBManager.queryByEvalue(ArgsConstants.EVALUE_MAJOR);
        mChoose = YiKaoApplication.getChooseMajorIndex();
        ChooseMajorAdapter adapter = new ChooseMajorAdapter(this,mList,mChoose);
        mGv.setAdapter(adapter);
    }

}
